﻿//-----------------------------------------------------------------------
// <copyright file="BookModel.cs" company="SampleThreeTier">
//     Sample 3 tier application by Anurag.
// </copyright>
//-----------------------------------------------------------------------

using System.ComponentModel;

namespace PresentationLayer.Models
{
    using System;
    using System.ComponentModel.DataAnnotations;

    /// <summary>
    /// The Book Model
    /// </summary>
    public class BookModel
    {
        /// <summary>
        /// Gets or sets the identifier.
        /// </summary>
        /// <value>
        /// The identifier.
        /// </value>
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>
        /// The name.
        /// </value>
        [Required(ErrorMessage = "The name of the book is required")]
        [StringLength(50, ErrorMessage = "Please enter at most 50 characters for book name")]
        [DisplayName("Book Name")]
        [RegularExpression(@"^[a-zA-Z ]+$", ErrorMessage = "Please enter alphabets and space only")]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the name of the author.
        /// </summary>
        /// <value>
        /// The name of the author.
        /// </value>
        [StringLength(50, ErrorMessage = "Please enter at most 50 characters for author name")]
        [Required(ErrorMessage = "The author name is required")]
        [RegularExpression(@"^[a-zA-Z ]+$", ErrorMessage = "Please enter alphabets and space only")]
        public string AuthorName { get; set; }

        /// <summary>
        /// Gets or sets the genre of the book.
        /// </summary>
        /// <value>
        /// The genre of the book.
        /// </value>
        [StringLength(50, ErrorMessage = "Please enter at most 50 characters for genre")]
        [RegularExpression(@"^[a-zA-Z ]+$", ErrorMessage = "Please enter alphabets and space only")]
        public string Genre { get; set; }
    }
}